#include "procfs.h"

static struct proc_dir_entry  *proc_dir;
static char root_dir[30]="driver/fpga_dev";

static int reset_write(struct file *filp, const char *buffer, unsigned long count, void *data)
{
	unsigned int read_value;

	sscanf(buffer, "%d",&read_value); //address

	if(read_value==1)
		write16(0x0, 0x01);

	#ifdef __DEBUG__
	printk(KERN_ALERT "DEBUG_M: cmd write - end\n");
	#endif	
	return count;
}


int procfs_register(void)
{
	struct proc_dir_entry *procfs_reset;
	

	#ifdef __DEBUG__
	printk(KERN_ALERT "procfs registering\n");
	#endif	

	proc_dir = proc_mkdir(root_dir, NULL);

	procfs_reset = create_proc_entry("reset", S_IRUGO|S_IWUSR, proc_dir);
	procfs_reset->write_proc = reset_write;
	return 0;
}


int procfs_unregister(void)
{
	remove_proc_entry("reset", proc_dir);	
	remove_proc_entry(root_dir,NULL);
	return 0;
}

